package com.pzhu.user.domain.entity.converter;

import com.pzhu.user.domain.entity.User;
import com.pzhu.user.domain.ro.UserCreateRO;
import com.pzhu.user.domain.ro.UserUpdateRO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import com.pzhu.base.common.utils.json.JSONUtils;

@Mapper(
        componentModel = MappingConstants.ComponentModel.SPRING,
        imports = {JSONUtils.class})
public interface UserEntityConverter {

    @Mapping(target = "province", ignore = true)
    @Mapping(target = "nickname", ignore = true)
    @Mapping(target = "gender", ignore = true)
    @Mapping(target = "country", ignore = true)
    @Mapping(target = "city", ignore = true)
    @Mapping(target = "birthday", ignore = true)
    @Mapping(target = "avatar", ignore = true)
    @Mapping(target = "status", ignore = true)
    @Mapping(target = "id", ignore = true)
    User convert(UserCreateRO userCreateRo);


    @Mapping(target = "username", ignore = true)
    @Mapping(target = "status", ignore = true)
    @Mapping(target = "province", ignore = true)
    @Mapping(target = "password", ignore = true)
    @Mapping(target = "gender", ignore = true)
    @Mapping(target = "country", ignore = true)
    @Mapping(target = "city", ignore = true)
    @Mapping(target = "birthday", ignore = true)
    @Mapping(target = "avatar", ignore = true)
    User convert(Long id, UserUpdateRO userUpdateRo);
}
